package com.foreknow.elmboot.mapper;

import com.foreknow.elmboot.po.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

    @Mapper
    public interface UserMapper {
        /**
         * 登录
         * @param userId
         * @param password
         * @return User对象
         * @throws Exception
         */
        @Select("select * from user where userId=#{userId} and password=#{password}")
        public User getUserByIdByPass(String userId,String password) throws Exception;

        /**
         * 注册
         * @param user
         * @return int
         * @throws Exception
         */
        @Insert("insert into user values(#{userId},#{password},#{userName},#{userSex},#{userImg},1)")
        public int saveUser(User user)throws Exception;
    }

